SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.DnnProduct_GetTabSettings
	@TabID int

AS
	SELECT 
		SettingName,
		CASE WHEN LEFT(LOWER(dbo.DnnProduct_TabSettings.SettingValue), 6) = 'fileid' 
			THEN
				(SELECT Folder + FileName  
					FROM dbo.DnnProduct_Files 
					WHERE 'fileid=' + CONVERT(VARCHAR,dbo.DnnProduct_Files.FileID) = dbo.DnnProduct_TabSettings.SettingValue
				) 
			ELSE 
				dbo.DnnProduct_TabSettings.SettingValue  
			END AS SettingValue
	FROM 	dbo.DnnProduct_TabSettings 
	WHERE	TabID = @TabID

GO
